﻿using cfg;
using cfg.Table;
using MonKey.Extensions;
using QFramework;
using SimpleJSON;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine;

namespace Game.Assets.Scripts.Manager
{
    public class TableManager : AbstractModel
    {
        public Tables Tables { get; private set; }

        public Producer GetTemplateData(int id ) {
            return Tables.TbProducer.GetOrDefault(id);
        }

        protected override void OnInit()
        {
            string configPath = "Config";
            Tables = new cfg.Tables(file => JSON.Parse(Resources.Load<TextAsset>($"{configPath}/{file}").text));
            UnityEngine.Debug.Log("table manager on init" +
                "");
        }
    }
}
